import React from 'react';
import {View, ActivityIndicator, Text} from 'react-native';

export default ({text = null, show = true, style = {}, size = 'large', color = '#999'}) => {
    if (!show) return null;
    return (
        <View style={{
            flex: 1,
            alignItems: 'center',
            justifyContent: 'center',
            paddingVertical: 30,
            ...style
        }}>
            <View>
                <ActivityIndicator size={size} color={color}/>
                {
                    text ?
                        <View style={{justifyContent: 'center', marginLeft: 8}}>
                            <Text style={{
                                fontSize: 15,
                                color: '#666'
                            }}>{text}</Text>
                        </View>
                        : null
                }
            </View>
        </View>
    );
}